package com.four.basicinfo.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.four.basicinfo.entity.Parents;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ParentsDao extends BaseMapper<Parents> {
    @Select("select name from parents where number=#{number}")
    public List<String> selectName(String number);


    @Select("select * from parents where name=#{name}")
    public Parents selectInfo(String name);

    //查询个人
    @Select("select id, number, name, relationship, is_live as isLive, marriage, unit, duties, unit_nature as unitNature, is_senior as isSenior, " +
            "is_abroad as isAbroad, identity from parents where number=#{number}")
    public List<Parents> selectByNum(String number);

    /**
     * 查询家庭主要成员
     *
     * @param id 家庭主要成员主键
     * @return 家庭主要成员
     */
    public Parents selectParentsById(Long id);

    /**
     * 新增家庭主要成员
     *
     * @param parents 家庭主要成员
     * @return 结果
     */
    /*@Insert("insert into parents (number, name, relationship, is_live, marriage, unit, duties, unit_nature, is_senior," +
            "is_abroad, identity) valuse(#{number}, #{name}, #{relationship},  #{isLive}, #{marriage}, #{unit}, #{duties},#{unitNature},#{isSenior}," +
            "#{isAbroad}, #{identity})")*/
    public int insertParents(Parents parents);

    /**
     * 修改家庭主要成员
     *
     * @param parents 家庭主要成员
     * @return 结果
     */
    public int updateParents(Parents parents);

    /**
     * 删除家庭主要成员
     *
     * @param id 家庭主要成员主键
     * @return 结果
     */
    public int deleteParentsById(Long id);
}
